

import socket
import time
BUFSIZE = 1024
client = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
client.settimeout(3)
import dns.resolver
#hostip = dns.resolver.query('vvv.cs-iot.cn','A')


hostip =socket.gethostbyname('build.cs-iot.cn')

print(hostip)

starttime = time.time()
print("total time:%d" %(starttime))
x=0
for num in range(0,1):
    #msg = input(">> ").strip()
    msg = "012"
    ip_port = (hostip, 8902)
    client.sendto(msg.encode('utf-8'),ip_port)
    data,server_addr = client.recvfrom(BUFSIZE)
    print('客%s--%s'%(data,server_addr))
client.close()

endtime  = time.time()

print("total time:%d" %(endtime - starttime))
